<template>
  <!-- 净借记限额质押/授信分配管理查询明细页面弹出框-->
  <el-dialog
    title="净借记限额质押/授信分配管理查询明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="true"
    @close="closeFn"
  >
    <el-form ref="detailsForm" :model="formData" label-width="180px" :disabled="true">
      <el-card class="form-card txnInfo-card">
        <div slot="header" class="label-header-msg">
          <span>基本信息详情</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="交易流水号：" prop="id">
              <el-input v-model="formData.id" placeholder="交易流水号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文标识号：" prop="pkgId">
              <el-input v-model="formData.pkgId" placeholder="报文标识号" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="工作日期：" prop="cpgdate">
              <el-date-picker
                v-model="formData.cpgdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="大小额日期：" prop="workdate">
              <el-date-picker
                v-model="formData.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="发起参与机构：" prop="directSender">
              <el-input v-model="formData.directSender" placeholder="发起参与机构" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发起参与机构名称：" prop="directSenderName">
              <el-input v-model="formData.directSenderName" placeholder="发起参与机构名称" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="调整额度种类：" prop="operClass">
              <el-select v-model="formData.operClass" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.OPR_CLASS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="调整类型：" prop="operType">
              <el-select v-model="formData.operType" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.OPERATIONTYPECODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="清算行数目：" prop="memNum">
              <el-input v-model="formData.memNum" placeholder="清算行数目" />
            </el-form-item>
          </el-col>
          <el-col :span="12"></el-col>
        </el-row>
      </el-card>
    </el-form>

    <el-card class="form-card txnInfo-card">
      <div slot="header" class="label-header-msg">
        <span>清算行调整明细信息</span>
      </div>
      <div style="height: 300px; margin-bottom: 20px">
        <ht-table
          ref="flowTable"
          :showSerialNumber="false"
          :multi-select="false"
          :dictMap="dictMap"
          :reqConfig="reqConfig"
          :queryParams="queryParams"
          :tableBindColumns="tableBindColumns"
          :opButtonList="opButtonList"
          :randomRowKey="true"
          :initData="false"
          defaultEventKey="flowTable"
          style="height: 100%"
        ></ht-table>
      </div>
      <el-form ref="detailsForm" :model="formData" label-width="180px" :disabled="true">
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务状态：" prop="txnStatus">
              <el-select v-model="formData.txnStatus" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.TXN_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12"></el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="通讯状态：" prop="comStatus">
              <el-select v-model="formData.comStatus" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PKG_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="中心状态：" prop="procStatus">
              <el-select v-model="formData.procStatus" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="录入操作员：" prop="mdTlrno">
              <el-input v-model="formData.mdTlrno" placeholder="录入操作员" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="录入时间：" prop="mdTime">
              <el-date-picker
                v-model="formData.mdTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="选择时间"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="报文发送时间：" prop="sndTime">
              <el-date-picker
                v-model="formData.sndTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="选择时间"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="通用报文处理码：" prop="procCode">
              <el-select v-model="formData.procCode" placeholder="请选择" style="width: 100%" disabled>
                <el-option
                  :label="`${formData.procCode ? formData.procCode : ''}${formData.procDesc ? '-' + formData.procDesc : ''}`"
                  :value="formData.procCode"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="业务处理信息：" prop="txnRemarks">
              <el-input
                type="textarea"
                v-model="formData.txnRemarks"
                placeholder="业务处理信息"
                maxlength="256"
                show-word-limit
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeFn">关闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { detailsearch } from "@/api/cnaps/saps/otherCommQuery/net_credit_all_query.js";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";
export default {
  name: "QueryDetails",
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      detailsData: null, // 明细操作传值
      // 是否显示弹出层
      open: false,
      reqConfig: detailsearch,
      // 查询参数
      queryParams: {
        id: "",
      },
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `清算行行号`,
          prop: "memStBrno",
          align: "center",
          sortable: false,
        },
        {
          label: `货币币种`,
          prop: "memAmountcurcd",
          align: "center",
          sortable: false,
        },
        {
          label: `调整额度`,
          prop: "memAmount",
          align: "center",
          sortable: false,
          type: "price",
        },
      ],
    };
  },
  mounted() {},
  watch: {
    open(d) {
      if (d) {
        this.$nextTick(() => {
          if (this.formData && this.formData.id) {
            this.$set(this.queryParams, "id", this.formData.id);
            this.$refs.flowTable.doQuery();
          }
        });
      }
    },
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
      this.queryParams.id = this.formData.id;
      this.$nextTick(() => {
        this.$refs.flowTable.doQuery();
      });

    },
  },
};
</script>
<style lang="scss" scoped>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
